
//
//  FSSearchController.m
//  fanshu
//
//  Created by mh on 16/3/29.
//  Copyright © 2016年 FS. All rights reserved.
//

#import "FSSearchController.h"
#import "FSTextField.h"
@interface FSSearchController ()<UITextFieldDelegate>

@end

@implementation FSSearchController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    //添加输入框
    [self addTextField];
}
//添加输入框
- (void)addTextField{
    FSTextField *textField = [[FSTextField alloc] initWithFrame:CGRectMake(0, 20, ScreenWidth, 44)];
    [self.view addSubview:textField];
    [textField becomeFirstResponder];
    __weak typeof(self) weakSelf = self;
    textField.cancleBtnOnClick = ^{
        [weakSelf back];
    };
    
    textField.searchBarOnClick = ^{
        FSLog(@"搜索");
    };
}

//dismiss
- (void)back{
    [self dismissViewControllerAnimated:YES completion:nil];
}

- (void)viewWillDisappear:(BOOL)animated{
    [self.view endEditing:YES];
}
@end
